



<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      <meta http-equiv="x-ua-compatible" content="ie=edge">
      
      
      
      
        <meta name="lang:clipboard.copy" content="Copy to clipboard">
      
        <meta name="lang:clipboard.copied" content="Copied to clipboard">
      
        <meta name="lang:search.language" content="en">
      
        <meta name="lang:search.pipeline.stopwords" content="True">
      
        <meta name="lang:search.pipeline.trimmer" content="True">
      
        <meta name="lang:search.result.none" content="No matching documents">
      
        <meta name="lang:search.result.one" content="1 matching document">
      
        <meta name="lang:search.result.other" content="# matching documents">
      
        <meta name="lang:search.tokenizer" content="[\s\-]+">
      
      <link rel="shortcut icon" href="../assets/images/favicon.png">
      <meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.6.0">
    
    
      
        <title>Interfaces - ParNMPC Homepage</title>
      
    
    
      <link rel="stylesheet" href="../assets/stylesheets/application.1b62728e.css">
      
        <link rel="stylesheet" href="../assets/stylesheets/application-palette.a8b3c06d.css">
      
      
        
        
        <meta name="theme-color" content="#3f51b5">
      
    
    
      <script src="../assets/javascripts/modernizr.268332fc.js"></script>
    
    
      
        <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
        <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
      
    
    <link rel="stylesheet" href="../assets/fonts/material-icons.css">
    
    
    
      
        
<script>
  window.ga = window.ga || function() {
    (ga.q = ga.q || []).push(arguments)
  }
  ga.l = +new Date
  /* Setup integration and send page view */
  ga("create", "UA-120133947-1", "auto")
  ga("set", "anonymizeIp", true)
  ga("send", "pageview")
  /* Register handler to log search on blur */
  document.addEventListener("DOMContentLoaded", () => {
    if (document.forms.search) {
      var query = document.forms.search.query
      query.addEventListener("blur", function() {
        if (this.value) {
          var path = document.location.pathname;
          ga("send", "pageview", path + "?q=" + this.value)
        }
      })
    }
  })
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
      
    
    
  </head>
  
    
    
    <body dir="ltr" data-md-color-primary="indigo" data-md-color-accent="indigo">
  
    <svg class="md-svg">
      <defs>
        
        
          <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
        
      </defs>
    </svg>
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
    
      <a href="#interfaces" tabindex="1" class="md-skip">
        Skip to content
      </a>
    
    
      <header class="md-header" data-md-component="header">
  <nav class="md-header-nav md-grid">
    <div class="md-flex">
      <div class="md-flex__cell md-flex__cell--shrink">
        <a href=".." title="ParNMPC Homepage" class="md-header-nav__button md-logo">
          
            <i class="md-icon"></i>
          
        </a>
      </div>
      <div class="md-flex__cell md-flex__cell--shrink">
        <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
      </div>
      <div class="md-flex__cell md-flex__cell--stretch">
        <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
          
            <span class="md-header-nav__topic">
              ParNMPC Homepage
            </span>
            <span class="md-header-nav__topic">
              
                Interfaces
              
            </span>
          
        </div>
      </div>
      <div class="md-flex__cell md-flex__cell--shrink">
        
          <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
          
<div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
      <label class="md-icon md-search__icon" for="__search"></label>
      <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
        &#xE5CD;
      </button>
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="result">
          <div class="md-search-result__meta">
            Type to start searching
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
        
      </div>
      
        <div class="md-flex__cell md-flex__cell--shrink">
          <div class="md-header-nav__source">
            


  

<a href="https://github.com/deng-haoyang/ParNMPC" title="Go to repository" class="md-source" data-md-source="github">
  
    <div class="md-source__icon">
      <svg viewBox="0 0 24 24" width="24" height="24">
        <use xlink:href="#__github" width="24" height="24"></use>
      </svg>
    </div>
  
  <div class="md-source__repository">
    GitHub
  </div>
</a>
          </div>
        </div>
      
    </div>
  </nav>
</header>
    
    <div class="md-container">
      
        
      
      
      <main class="md-main" role="main">
        <div class="md-main__inner md-grid" data-md-component="container">
          
            
              <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    <nav class="md-nav md-nav--primary" data-md-level="0">
  <label class="md-nav__title md-nav__title--site" for="__drawer">
    <a href=".." title="ParNMPC Homepage" class="md-nav__button md-logo">
      
        <i class="md-icon"></i>
      
    </a>
    ParNMPC Homepage
  </label>
  
    <div class="md-nav__source">
      


  

<a href="https://github.com/deng-haoyang/ParNMPC" title="Go to repository" class="md-source" data-md-source="github">
  
    <div class="md-source__icon">
      <svg viewBox="0 0 24 24" width="24" height="24">
        <use xlink:href="#__github" width="24" height="24"></use>
      </svg>
    </div>
  
  <div class="md-source__repository">
    GitHub
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      


  <li class="md-nav__item">
    <a href=".." title="Introduction" class="md-nav__link">
      Introduction
    </a>
  </li>

    
      
      
      


  <li class="md-nav__item">
    <a href="../installation/" title="Installation" class="md-nav__link">
      Installation
    </a>
  </li>

    
      
      
      

  


  <li class="md-nav__item md-nav__item--active">
    
    <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
    
      
    
    
      <label class="md-nav__link md-nav__link--active" for="__toc">
        Interfaces
      </label>
    
    <a href="./" title="Interfaces" class="md-nav__link md-nav__link--active">
      Interfaces
    </a>
    
      
<nav class="md-nav md-nav--secondary">
  
  
    
  
  
    <label class="md-nav__title" for="__toc">Table of contents</label>
    <ul class="md-nav__list" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#classes" class="md-nav__link">
    Classes
  </a>
  
    <nav class="md-nav">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#optimalcontrolproblem" class="md-nav__link">
    OptimalControlProblem
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#nmpcsolver" class="md-nav__link">
    NMPCSolver
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dynamicsystem" class="md-nav__link">
    DynamicSystem
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#functions" class="md-nav__link">
    Functions
  </a>
  
    <nav class="md-nav">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#nmpc_solve" class="md-nav__link">
    NMPC_Solve 
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#createoptions" class="md-nav__link">
    createOptions
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#nmpc_solve_codegen" class="md-nav__link">
    NMPC_Solve_CodeGen
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sim_plant_rk4" class="md-nav__link">
    SIM_Plant_RK4 
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#timer" class="md-nav__link">
    Timer
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
      
      
      
      
    </ul>
  
</nav>
    
  </li>

    
      
      
      


  <li class="md-nav__item">
    <a href="../workflow/" title="Workflow" class="md-nav__link">
      Workflow
    </a>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
    
    <label class="md-nav__link" for="nav-5">
      Examples
    </label>
    <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
      <label class="md-nav__title" for="nav-5">
        Examples
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../exp_damper/" title="Simulation: Semi-active Damper" class="md-nav__link">
      Simulation: Semi-active Damper
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../exp_double_pendulum/" title="Simulation: Double Inverted Pendulum on a Cart" class="md-nav__link">
      Simulation: Double Inverted Pendulum on a Cart
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../exp_quadrotor/" title="Simulation: Quadrotor" class="md-nav__link">
      Simulation: Quadrotor
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../exp_vehicle/" title="Simulation: Vehicle" class="md-nav__link">
      Simulation: Vehicle
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../exp_heli/" title="Experiment: Helicopter" class="md-nav__link">
      Experiment: Helicopter
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item">
    <a href="../tips/" title="Tips" class="md-nav__link">
      Tips
    </a>
  </li>

    
      
      
      


  <li class="md-nav__item">
    <a href="../about/" title="About" class="md-nav__link">
      About
    </a>
  </li>

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    
<nav class="md-nav md-nav--secondary">
  
  
    
  
  
    <label class="md-nav__title" for="__toc">Table of contents</label>
    <ul class="md-nav__list" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#classes" class="md-nav__link">
    Classes
  </a>
  
    <nav class="md-nav">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#optimalcontrolproblem" class="md-nav__link">
    OptimalControlProblem
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#nmpcsolver" class="md-nav__link">
    NMPCSolver
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dynamicsystem" class="md-nav__link">
    DynamicSystem
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#functions" class="md-nav__link">
    Functions
  </a>
  
    <nav class="md-nav">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#nmpc_solve" class="md-nav__link">
    NMPC_Solve 
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#createoptions" class="md-nav__link">
    createOptions
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#nmpc_solve_codegen" class="md-nav__link">
    NMPC_Solve_CodeGen
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#sim_plant_rk4" class="md-nav__link">
    SIM_Plant_RK4 
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#timer" class="md-nav__link">
    Timer
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
      
      
      
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          <div class="md-content">
            <article class="md-content__inner md-typeset">
              
                
                
                <h1 id="interfaces">Interfaces</h1>
<h2 id="classes">Classes</h2>
<table>
<thead>
<tr>
<th>Class name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">OptimalControlProblem</span></code></td>
<td>Formulate an OCP</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">NMPCSolver</span></code></td>
<td>Configurate the NMPC solver</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">DynamicSystem</span></code></td>
<td>Construct a dynamic system</td>
</tr>
</tbody>
</table>
<h3 id="optimalcontrolproblem"><code class="codehilite"><span class="err">OptimalControlProblem</span></code></h3>
<p>Formulate an OCP.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./NMPC_Problem_Formulation.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Properties</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">dim</span></code></td>
<td><code class="codehilite"><span class="err">structure.{lambda,mu,u,x,z,p}</span></code>, dimensions of lambda, mu, u, x, z, p.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">lambda</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.x,1]</span></code>, multiplier vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">mu</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.mu,1]</span></code>, multiplier vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">u</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.u,1]</span></code>, input vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">x</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.x,1]</span></code>, state vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">z</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [zDim,1]</span></code>, multiplier vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">p</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [pDim,1]</span></code>, parameter vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">f</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.x,1]</span></code>, function f.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">M</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.x,dim.x]</span></code>, matrix M .</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">L</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [1,1]</span></code>, function L.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">C</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.mu,1]</span></code>, function C.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">G</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.z,1]</span></code>, function G.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">N</span></code></td>
<td><code class="codehilite"><span class="err">positive integer [1,1]</span></code>, number of discretization grids N.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">T</span></code></td>
<td><code class="codehilite"><span class="err">positive [1,1]</span></code>, prediction horizon T.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">deltaTau</span></code></td>
<td><code class="codehilite"><span class="err">positive [1,1]</span></code>, discretization size (T/N).</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">discretizationMethod</span></code></td>
<td><code class="codehilite"><span class="err">string</span></code>, discretization method.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">isMEnabled</span></code></td>
<td><code class="codehilite"><span class="err">bool</span></code>, whether the M matrix is enabled.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">OptimalControlProblem</span></code></td>
<td>Constructor.<br>Input:<br><code class="codehilite"><span class="err">dim.u</span></code>: <code class="codehilite"><span class="err">positive integer [1,1]</span></code>, dimension of u.<br><code class="codehilite"><span class="err">dim.x</span></code>: <code class="codehilite"><span class="err">positive integer [1,1]</span></code>, dimension of x.<br><code class="codehilite"><span class="err">pDim</span></code>: <code class="codehilite"><span class="err">nonnegtive integer [1,1]</span></code>, dimension of p.<br><code class="codehilite"><span class="err">N</span></code>: <code class="codehilite"><span class="err">positive integer [1,1]</span></code>, number of discretization grids.<br>Output:<br><code class="codehilite"><span class="err">OptimalControlProblem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setf</span></code></td>
<td>Set f.<br>Inherit from <code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setM</span></code></td>
<td>Set M.<br>Inherit from <code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setStateName</span></code></td>
<td>Give names to all or part of the states.<br>Inherit from <code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setInputName</span></code></td>
<td>Give names to all or part of the inputs.<br>Inherit from <code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setParameterName</span></code></td>
<td>Give names to all or part of the parameters.<br>Inherit from <code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setL</span></code></td>
<td>Set L.<br>Input:<br><code class="codehilite"><span class="err">L</span></code>: <code class="codehilite"><span class="err">symbolic expression [1,1]</span></code>, function L.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setC</span></code></td>
<td>Set C.<br>Input:<br><code class="codehilite"><span class="err">C</span></code>: <code class="codehilite"><span class="err">symbolic expression [dim.mu,1]</span></code>, function C.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setT</span></code></td>
<td>Set T.<br>Input:<br><code class="codehilite"><span class="err">T</span></code>: <code class="codehilite"><span class="err">symbolic variable/double [1,1]</span></code>, must be included in <code class="codehilite"><span class="err">p</span></code> if it is a symbolic variable.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setG</span></code></td>
<td>Set G.<br>Input:<br><code class="codehilite"><span class="err">C</span></code>: <code class="codehilite"><span class="err">symbolic expression [dim.z,1]</span></code>, function G.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setDiscretizationMethod</span></code></td>
<td>Set the discretization method.<br>Input:<br><code class="codehilite"><span class="err">method</span></code>: <code class="codehilite"><span class="err">string</span></code>, <code class="codehilite"><span class="err">&#39;Euler&#39;</span></code>, <code class="codehilite"><span class="err">&#39;RK2&#39;</span></code>, or <code class="codehilite"><span class="err">&#39;RK4&#39;</span></code>, discretization method.<br>Output: none</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">codeGen</span></code></td>
<td>Generate necessary files.<br>Input: none.<br>Output: none.</td>
</tr>
</tbody>
</table>
<h3 id="nmpcsolver"><code class="codehilite"><span class="err">NMPCSolver</span></code></h3>
<p>Configurate the NMPC solver.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./NMPC_Problem_Formulation.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Properties</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">OCP</span></code></td>
<td><code class="codehilite"><span class="err">OptimalControlProblem</span></code>, OptimalControlProblem object.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">HessianApproximation</span></code></td>
<td><code class="codehilite"><span class="err">string</span></code>, Hessian approximation method.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">NMPCSolver</span></code></td>
<td>Constructor.<br>Input:<br><code class="codehilite"><span class="err">OCP</span></code>: <code class="codehilite"><span class="err">OptimalControlProblem</span></code>, OptimalControlProblem object.<br>Output:<br><code class="codehilite"><span class="err">NMPCSolver</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setHessianApproximation</span></code></td>
<td>Set the Hessian approximation method.<br>Input:<br><code class="codehilite"><span class="err">method</span></code>: <code class="codehilite"><span class="err">string</span></code>, <code class="codehilite"><span class="err">&#39;Newton&#39;</span></code>, <code class="codehilite"><span class="err">&#39;GaussNewton&#39;</span></code>, or <code class="codehilite"><span class="err">&#39;GaussNewtonLC&#39;</span></code>, Hessian approximation method.<br>Output: none</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">codeGen</span></code></td>
<td>Generate necessary files.<br>Input: none.<br>Output: none.</td>
</tr>
</tbody>
</table>
<h3 id="dynamicsystem"><code class="codehilite"><span class="err">DynamicSystem</span></code></h3>
<p>Construct a dynamic system <span><span class="MathJax_Preview">M(u(t),x(t),p(t))\dot{x}=f(u(t),x(t),p(t))</span><script type="math/tex">M(u(t),x(t),p(t))\dot{x}=f(u(t),x(t),p(t))</script></span>.</p>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./NMPC_Problem_Formulation.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Properties</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">dim</span></code></td>
<td><code class="codehilite"><span class="err">structure.{u;x;p}</span></code>, dimensions of u, x, p.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">u</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.u,1]</span></code>, input vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">x</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [dim.x,1]</span></code>, state vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">p</span></code></td>
<td><code class="codehilite"><span class="err">symbolic vector [pDim,1]</span></code>, parameter vector.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">f</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.x,1]</span></code>, function f.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">M</span></code></td>
<td><code class="codehilite"><span class="err">symbolic expression [dim.x,dim.x]</span></code>, matrix M .</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">isMEnabled</span></code></td>
<td><code class="codehilite"><span class="err">bool</span></code>, whether the M matrix is enabled.</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Functions</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">DynamicSystem</span></code></td>
<td>Constructor.<br>Input:<br><code class="codehilite"><span class="err">dim.u</span></code>: <code class="codehilite"><span class="err">[1,1]</span></code>, dimension of u.<br><code class="codehilite"><span class="err">dim.x</span></code>: <code class="codehilite"><span class="err">[1,1]</span></code>, dimension of x.<br><code class="codehilite"><span class="err">pDim</span></code>: <code class="codehilite"><span class="err">[1,1]</span></code>, dimension of p.<br>Output:<br><code class="codehilite"><span class="err">DynamicSystem</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setf</span></code></td>
<td>Set f.<br>Input:<br><code class="codehilite"><span class="err">f</span></code>: <code class="codehilite"><span class="err">symbolic expression [dim.x,1]</span></code>, function f.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setM</span></code></td>
<td>Set M.<br>Input:<br><code class="codehilite"><span class="err">M</span></code>: <code class="codehilite"><span class="err">symbolic expression [dim.x,dim.x]</span></code>, M matrix.<br>Output: none.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setStateName</span></code></td>
<td>Give names to all or part of the states.<br>Example:<br><code class="codehilite"><span class="err">[X,Y,Z] =~.setStateName({&#39;X&#39;,&#39;Y&#39;,&#39;Z&#39;});</span></code><br><code class="codehilite"><span class="err">[X,Z] =~.setStateName({&#39;X&#39;,&#39;Z&#39;},[1 3]);</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setInputName</span></code></td>
<td>Give names to all or part of the inputs.<br>Example:<br><code class="codehilite"><span class="err">[F1,F2,F3] =~.setInputName({&#39;F1&#39;,&#39;F2&#39;,&#39;F3&#39;};</span></code><br><code class="codehilite"><span class="err">[F1,F3] =~.setInputName({&#39;F1&#39;,&#39;F3&#39;},[1 3]);</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">setParameterName</span></code></td>
<td>Give names to all or part of the parameters.<br>Example:<br><code class="codehilite"><span class="err">[a,b,c] =~.setParameterName({&#39;a&#39;,&#39;b&#39;,&#39;c&#39;};</span></code><br><code class="codehilite"><span class="err">[a,c] =~.setParameterName({&#39;a&#39;,&#39;c&#39;},[1 3]);</span></code></td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">codeGen</span></code></td>
<td>Generate necessary files.<br>Input: none.<br>Output: none.</td>
</tr>
</tbody>
</table>
<h2 id="functions">Functions</h2>
<table>
<thead>
<tr>
<th>Function name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="codehilite"><span class="err">NMPC_Solve</span></code></td>
<td>Solve the NMPC problem.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">createOptions</span></code></td>
<td>Create an option struct for <code class="codehilite"><span class="err">NMPC_Solve</span></code>.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">NMPC_Solve_CodeGen</span></code></td>
<td>Generate code for <code class="codehilite"><span class="err">NMPC_Solve</span></code>.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">SIM_Plant_RK4</span></code></td>
<td>Simulate the dynamic system using the 4-th order Runge-Kutta method.</td>
</tr>
<tr>
<td><code class="codehilite"><span class="err">Timer</span></code></td>
<td>Measure the current time.</td>
</tr>
</tbody>
</table>
<h3 id="nmpc_solve"><code class="codehilite"><span class="err">NMPC_Solve</span></code> <div id="NMPC_Solve"></div></h3>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./Simu_Matlab.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Function name</th>
<th>NMPC_Solve</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description</td>
<td>Solve the NMPC problem.</td>
</tr>
<tr>
<td>Input</td>
<td><code class="codehilite"><span class="err">x0</span></code>: <code class="codehilite"><span class="err">[dim.x,1]</span></code>, initial state.<br><code class="codehilite"><span class="err">p</span></code>: <code class="codehilite"><span class="err">[pDim,N]</span></code>, given parameters.<br><code class="codehilite"><span class="err">options</span></code>: <code class="codehilite"><span class="err">struct</span></code>, options.</td>
</tr>
<tr>
<td>Output</td>
<td><code class="codehilite"><span class="err">solution</span></code>: <code class="codehilite"><span class="err">struct</span></code>, solution.<br><code class="codehilite"><span class="err">output</span></code>: <code class="codehilite"><span class="err">struct</span></code>, output information.</td>
</tr>
</tbody>
</table>
<h3 id="createoptions"><code class="codehilite"><span class="err">createOptions</span></code></h3>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./Simu_Matlab.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Function name</th>
<th>createOptions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description</td>
<td>Create an option struct for <code class="codehilite"><span class="err">NMPC_Solve</span></code>.</td>
</tr>
<tr>
<td>Input</td>
<td>None</td>
</tr>
<tr>
<td>Output</td>
<td><code class="codehilite"><span class="err">options</span></code>: <code class="codehilite"><span class="err">struct</span></code>, options.</td>
</tr>
</tbody>
</table>
<h3 id="nmpc_solve_codegen"><code class="codehilite"><span class="err">NMPC_Solve_CodeGen</span></code></h3>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./Simu_Simulink_Setup.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Function name</th>
<th>NMPC_Solve_CodeGen</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description</td>
<td>Generate code for function <code class="codehilite"><span class="err">NMPC_Solve</span></code>.</td>
</tr>
<tr>
<td>Input</td>
<td><code class="codehilite"><span class="err">target</span></code>: <code class="codehilite"><span class="err">string</span></code>, <code class="codehilite"><span class="err">&#39;mex&#39;</span></code>, <code class="codehilite"><span class="err">&#39;dll&#39;</span></code>, or <code class="codehilite"><span class="err">&#39;mex&#39;</span></code>, target.<br><code class="codehilite"><span class="err">targetLang</span></code>: <code class="codehilite"><span class="err">string</span></code>, <code class="codehilite"><span class="err">&#39;C&#39;</span></code> or '<code class="codehilite"><span class="err">C++</span></code>', target language.<br><code class="codehilite"><span class="err">options</span></code>: <code class="codehilite"><span class="err">struct</span></code>, options.</td>
</tr>
<tr>
<td>Output</td>
<td>None</td>
</tr>
</tbody>
</table>
<h3 id="sim_plant_rk4"><code class="codehilite"><span class="err">SIM_Plant_RK4</span></code> <div id="SIM_Plant_RK4"></div></h3>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./Simu_Matlab.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Function name</th>
<th>SIM_Plant_RK4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description</td>
<td>Simulate the dynamic system using the 4-th order Runge-Kutta method.</td>
</tr>
<tr>
<td>Input</td>
<td><code class="codehilite"><span class="err">u</span></code>: <code class="codehilite"><span class="err">[dim.u,1]</span></code>, inputs applied to the plant.<br><code class="codehilite"><span class="err">x</span></code>: <code class="codehilite"><span class="err">[dim.x,1]</span></code>, current state of the plant.<br><code class="codehilite"><span class="err">p</span></code>: <code class="codehilite"><span class="err">[pDim,1]</span></code>, given parameters.<br><code class="codehilite"><span class="err">Ts</span></code>: <code class="codehilite"><span class="err">positive [1,1]</span></code>, sampling interval.</td>
</tr>
<tr>
<td>Output</td>
<td><code class="codehilite"><span class="err">xNext</span></code>: <code class="codehilite"><span class="err">[dim.x,1]</span></code>, next state of the plant.</td>
</tr>
</tbody>
</table>
<h3 id="timer"><code class="codehilite"><span class="err">Timer</span></code></h3>
<div class="admonition example">
<p class="admonition-title">Example</p>
<p><code class="codehilite"><span class="err">./Timer.m</span></code></p>
</div>
<table>
<thead>
<tr>
<th>Function name</th>
<th>Timer</th>
</tr>
</thead>
<tbody>
<tr>
<td>Description</td>
<td>Measure the current time.</td>
</tr>
<tr>
<td>Input</td>
<td>None</td>
</tr>
<tr>
<td>Output</td>
<td><code class="codehilite"><span class="err">t</span></code>: <code class="codehilite"><span class="err">[1,1]</span></code>, current time.</td>
</tr>
<tr>
<td>Statement</td>
<td>Create <code class="codehilite"><span class="err">Timer.m</span></code> in the working directory to specify your own timer function.</td>
</tr>
</tbody>
</table>
                
                  
                
                
              
              
                


              
            </article>
          </div>
        </div>
      </main>
      
        
<footer class="md-footer">
  
    <div class="md-footer-nav">
      <nav class="md-footer-nav__inner md-grid">
        
          <a href="../installation/" title="Installation" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
            <div class="md-flex__cell md-flex__cell--shrink">
              <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
            </div>
            <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
              <span class="md-flex__ellipsis">
                <span class="md-footer-nav__direction">
                  Previous
                </span>
                Installation
              </span>
            </div>
          </a>
        
        
          <a href="../workflow/" title="Workflow" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
            <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
              <span class="md-flex__ellipsis">
                <span class="md-footer-nav__direction">
                  Next
                </span>
                Workflow
              </span>
            </div>
            <div class="md-flex__cell md-flex__cell--shrink">
              <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
            </div>
          </a>
        
      </nav>
    </div>
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-footer-copyright">
        
        powered by
        <a href="https://www.mkdocs.org">MkDocs</a>
        and
        <a href="https://squidfunk.github.io/mkdocs-material/">
          Material for MkDocs</a>
      </div>
      
    </div>
  </div>
</footer>
      
    </div>
    
      <script src="../assets/javascripts/application.808e90bb.js"></script>
      
      <script>app.initialize({version:"1.0.4",url:{base:".."}})</script>
      
        <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML"></script>
      
    
  </body>
</html>